
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using RobotPratolSolution.Pages;

public class CronManageNewViewModel : ObservableObject
{
    public string CronExpression { get; set; } = string.Empty;
    public string CronDescription { get; set; } = string.Empty;
    public string CronName { get; set; } = string.Empty;
    public bool IsEnabled { get; set; } = true;
    public RelayCommand GenerateCronCommand { get; }
    public RelayCommand RefreshCommand { get; }


    //private string _CurrentCronJob;

    //public string CurrentCronJob
    //{
    //    get { return _CurrentCronJob; }
    //    set { 
    //        _CurrentCronJob = value;

    //    }
    //}


    public void SaveCron()
    {
        // Save logic here
    }
    public void DeleteCron()
    {
        // Delete logic here
    }

    private void GenerateCronExpression()
    {
        var dialog = new CronExpressionDialog();
        if (dialog.ShowDialog() == true)
        {
           // CurrentCronJob.CronExpression = dialog.SelectedCronExpression;
        }
    }

    private void LoadCronJobs()
    {
        // Load logic here
    }

    public CronManageNewViewModel()
    {
        GenerateCronCommand = new RelayCommand(GenerateCronExpression);
        RefreshCommand = new RelayCommand(() => LoadCronJobs());
    }
}